class MemosController < ApplicationController

  before_filter :login_required

  def index
    @memoes = current_user.memos.paginate :page => params[:page],
                                          :order => 'created_at DESC',
                                          :per_page => 10
  end

  def new
    @memo = Memo.new

    respond_to do |format|
      format.html
    end
    
  end

  def create
    @memo = Memo.new(params[:memo])
    @memo.user_id = current_user.id
    
    respond_to do |format|
      if @memo.save
        flash[:notice] = 'Memo was successfully created.'
        format.html { redirect_to :controller => :memos, :action => :index }
      else
        format.html { render :action => "new" }
      end
    end
  end

  def show
    @memo = Memo.find(params[:id])
  end

  def edit
  end

end
